package cn.achuan.spring.springcloud.demo.product;

import com.google.common.base.MoreObjects;

/**
 * 商品消息。
 */
public class ProductMsg {
    /** 消息类型：更新商品，值为: {@value} */
    public static final String P_UPDATE = "update";

    /** 消息类型：删除商品，值为: {@value} */
    public static final String P_DELETE = "delete";

    // 表示本次消息是什么消息，比如商品更新消息还是商品删除消息
    private String action;

    // 所变更或删除商品的货号(或者商品的ID)
    private String itemCode;

    public ProductMsg() {}

    public ProductMsg(String action, String itemCode) {
        this.action = action;
        this.itemCode = itemCode;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("action", this.getAction())
                .add("itemCode", this.getItemCode()).toString();
    }

    public String getAction() {
        return action;
    }
    public void setAction(String action) {
        this.action = action;
    }

    public String getItemCode() {
        return itemCode;
    }
    public void setItemCode(String itemCode) {
        this.itemCode = itemCode;
    }
}